<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<script type="text/javascript" charset="utf-8"
	src="<?php echo Yii::app()->baseUrl?>/kindeditor/kindeditor-min.js"></script>
<script type="text/javascript" charset="utf-8"
	src="<?php echo Yii::app()->baseUrl?>/layer/layer.js"></script>
<script type="text/javascript" charset="utf-8"
	src="<?php echo Yii::app()->baseUrl?>/layer/modernizr.custom.js"></script>
<script type="text/javascript"
	src="<?php echo Yii::app()->baseUrl?>/kindeditor/h5Client.js"></script>
<link rel="stylesheet"
	href="http://kindeditor.net/ke4/themes/default/default.css"
	type="text/css" />
<link rel="stylesheet"
	href="<?php echo Yii::app()->baseUrl?>/css/default.css" type="text/css" />
<link rel="stylesheet"
	href="<?php echo Yii::app()->baseUrl?>/css/component.css"
	type="text/css" />
<style>
.search_btn {
	border-radius: 5px;
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-bottom-right-radius: 0px;
	border-top-right-radius: 0px;
}

.am-tabs-default .am-tabs-nav>.am-active a {
	background-color: #CD853F;
	color: #fff;
	/*           border-radius:5px;
           -webkit-border-radius:5px;
           -moz-border-radius:5px;
           border-bottom-right-radius: 0px;
           border-top-right-radius: 0px;*/
}

.am-tabs-default .am-tabs-nav a {
	background-color: #CDAD00;
	color: #222;
	line-height: 42px;
	/*            border-radius:5px;
            -webkit-border-radius:5px;
            -moz-border-radius:5px;
            border-bottom-left-radius: 0px;
            border-top-left-radius: 0px;*/
}

.middle-demo-1 {
	height: 3em;
	line-height: 1em;
	overflow: hidden;
}

.ul_li_img {
	width: 10%;
	margin-top: 5px;
	margin-left: 1em;
}

.ul_li_span {
	font-size: 20px;
	margin-left: 1em;
}

.i_ul_rel {
	display: block;
	padding: 0 0 0 14px;
	left: -10px;
	position: relative;
	list-style-type: none;
}

.i_li_left {
	margin-top: -12px;
	padding-left: 5px;
	width: 50%;
	position: relative;
	margin-bottom: 6px;
	box-sizing: border-box;
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	float: left;
}

.i_txt {
	font-size: 16px;
	color: #323232;
	height: 20px;
	line-height: 18px;
	/*margin: 10px 0 6px;*/
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	/*padding: 0 6px;*/
	word-break: break-all;
}

.am-input-group-primary .am-input-group-btn>.am-btn,
	.am-input-group-primary .am-input-group-label, .am-input-group-primary.am-input-group .am-form-field
	{
	border-color: #CD853F;
}

.am-tabs-default .am-tabs-nav a {
	background-color: #CDAD00;
	color: #222;
	line-height: 42px;
	border-radius: 5px;
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
}

.am-tabs-bd {
	position: relative;
	overflow: hidden;
	border: 0px solid #ddd;
	border-top: none;
	z-index: 100;
	-webkit-transition: height .3s;
	transition: height .3s;
}
</style>
<script>
        function loadding(){
            layer.load(0, {shade: [0.1,"#070707"] });
            return false;
        } 
        
        function close(){
            layer.closeAll(); //疯狂模式，关闭所有层
        } 
        function selectIndex(){
            if($("#select_text").val()!=""){
                var text=$("#select_text").val();
                var type=2;
                //判断是否为数字
                if(/^\d+$/.test(text)){
                    type=1;
                }
                loadding();
                window.location.href="<?php echo Yii::app()->baseUrl?>/index.php/default/selectIndex?username="+$("#select_text").val()+"&type="+type; 
                close();
            }
        }
        function vote(id){
	        if(isWeiXin()==true)
	            {
	        	alert('投票需通过"智慧烟台"app,登入成功后即可参加投票！');
	        	window.location.href="http://www.zhyantai.com/folder53/index.html";
	        	return false;
	            }
	        else
	        {
	        	hgClient.getUserInfo(function(response) {
	        		
	                var userInfo = response && (response.userInfo || response)
	     					|| '';
	     			userInfo = jQuery.parseJSON(JSON.stringify(userInfo));
	     			var userTokenKey = userInfo.userTokenKey;
	     			var app_user_id = userInfo.userid;
	     			
	     			if (userTokenKey == null ||userTokenKey.length == 0)
	     			{
	     				hgClient.goLogin();
	     				return false;
	     			}
	     			else
	     			{
	    				loadding();
	    				var _json = jQuery.param({
	      					"id" : id,
	      					"app_user_id" : app_user_id,
	      					"openid" : device_token								
	      				});
    	 	            var url='<?php echo Yii::app()->baseUrl?>/index.php/default/set_vote';
    	 	         
    	 	            jQuery.ajax(
    	    	 	            {
   	    	 	            	 'url':url,
    	        	 	         'type':'POST',
     	        	 	         'async' : false,
       	        	 	         'data':_json,
       	        	 	         'dataType':'json',
           	        	 	     'cache':false,
        	 	                 'complete':function(data){
     	 	              		 var dic = data.responseText;
    	 	                     close();
    	 	                     if(dic=="每天只能投一票，谢谢。"){
    	 	                        layer.alert(dic, {icon: 7},function(index){  
    	 	                        location.reload();
    	 	                        }); 
    	 	                     }else{
    	 	                        layer.alert(dic, {icon: 6},function(index){  
    	 	                        location.reload();
    	 	                        });                         
    	 	                     }
    	 	                }
     	 	            });
    	 	            return false;        
     				}
               });
        	}
        }
        //加载更多
        function loadMore(count,number){
            loadding();
            var url='<?php echo Yii::app()->baseUrl?>/index.php/default/loadMore';
            jQuery.ajax({'type':'POST','url':url,'success':function(data){
                    var d_t=eval("("+data+")");
                    var temp="";
                    for(var i=0;i<d_t.length;i++){
                        temp+='<li class="i_li_left">'+
                                '<div style="border:solid 1px #cdccc9; background-color:#F0F8FF; ">'+
                                    '<a href="<?php echo Yii::app()->baseUrl?>/index.php/default/children_msg/'+d_t[i].id+'">'+
                                        '<div style=" text-align: center; margin: 10px 10px; background-color: #EEEEEE;">'+
                                            '<img src="'+d_t[i].head_image+'"style="min-height: 150px; width: 100%; padding:10px 10px 0px 10px;">'+
                                            '<span class="i_txt">'+d_t[i].id+'号：'+d_t[i].username+'</span>'+
                                        '</div>'+
                                    '</a>'+
                                    '<div style=" text-align: center; margin-bottom: 1em; ">'+
                                        '<button onclick="vote('+d_t[i].id+')" type="button" class="am-btn am-btn-danger" style="font-size: 13px;border-radius:10px;-webkit-border-radius:5px;-moz-border-radius:5px">投票</button>'+
                                        '<span style="color: #CD853F; margin-left: 0.5em; vertical-align:middle;">'+d_t[i].number+'票</span>'+
                                    '</div>'+
                                '</div>'+
                               '</li>';
                    }
                    var new_num=number+10;
                    if(count>(new_num)){
                        var temp_btn='<button onclick="loadMore('+count+','+new_num+')" type="button" class="am-btn am-btn-danger am-round" style=" width: 250px;">加载更多</button>';
                        document.getElementById("div_more").innerHTML=temp_btn;
                    }else{
                       document.getElementById("div_more").innerHTML=""; 
                   }
                    $("#hot_ul").append(temp); 
                    
//                    document.getElementById("hot_ul").innerHTML+=temp;
                    new AnimOnScroll( document.getElementById( 'hot_ul' ), {
                    minDuration : 0.4,
                    maxDuration : 0.7,
                    viewportFactor : 0.2
                        } );
                    close(); 
                    
            },'cache':false,'data':"number="+number});
            return false; 
        }
        //加载更多
        function loadMore2(count,number){
            loadding();
            var url='<?php echo Yii::app()->baseUrl?>/index.php/default/loadMore2';
            jQuery.ajax({'type':'POST','url':url,'success':function(data){
                    var d_t=eval("("+data+")");
                    var temp="";
                    for(var i=0;i<d_t.length;i++){
                        temp+='<li class="i_li_left">'+
                                '<div style="border:solid 1px #cdccc9; background-color:#F0F8FF; ">'+
                                    '<a href="<?php echo Yii::app()->baseUrl?>/index.php/default/children_msg/'+d_t[i].id+'">'+
                                        '<div style=" text-align: center; margin: 10px 10px; background-color: #EEEEEE;">'+
                                            '<img src="'+d_t[i].head_image+'"style="min-height: 150px; width: 100%; padding:10px 10px 0px 10px;">'+
                                            '<span class="i_txt">'+d_t[i].id+'号：'+d_t[i].username+'</span>'+
                                        '</div>'+
                                    '</a>'+
                                    '<div style=" text-align: center; margin-bottom: 1em; ">'+
                                        '<button onclick="vote('+d_t[i].id+')" type="button" class="am-btn am-btn-danger" style="font-size: 13px;border-radius:10px;-webkit-border-radius:5px;-moz-border-radius:5px">投票</button>'+
                                        '<span style="color: #CD853F; margin-left: 0.5em; vertical-align:middle;">'+d_t[i].number+'票</span>'+
                                    '</div>'+
                                '</div>'+
                               '</li>';
                    }
                    var new_num=number+10;
                    if(count>(new_num)){
                        var temp_btn='<button onclick="loadMore2('+count+','+new_num+')" type="button" class="am-btn am-btn-danger am-round" style=" width: 250px;">加载更多</button>';
                        document.getElementById("div_more2").innerHTML=temp_btn;
                    }else{
                       document.getElementById("div_more2").innerHTML=""; 
                   }
                    $("#hot_ul2").append(temp); 
                    
					//document.getElementById("hot_ul").innerHTML+=temp;
                    new AnimOnScroll( document.getElementById( 'hot_ul2' ), {
                    minDuration : 0.4,
                    maxDuration : 0.7,
                    viewportFactor : 0.2
                        } );
                    close(); 
                    
            },'cache':false,'data':"number="+number});
            return false; 
        }  
        
        function isWeiXin(){
            var ua = window.navigator.userAgent.toLowerCase();
            if(ua.match(/MicroMessenger/i) == 'micromessenger' || ua.match(/QQ/i) == "qq"){
                return true;
            }else{
                return false;
            }
        }
        var device_token='';
        $(function () {
        	hgClient.getSystemInfo(function( response ){//获取设备信息
				var systemInfo = response.deviceInfo || response;
				systemInfo = jQuery.parseJSON(JSON.stringify(systemInfo));
	     		device_token = systemInfo.device_token;
			});
        });
    </script>
</head>
<body style="background-color: #EEEEEE;">
	<div>
		<!--中间大图-->
		<div>
			<img style="width: 100%; height: 25%"
				src="<?php echo $votemodel->head_image;?>" />
		</div>
		<div style="background-color: #FFFFFF">
			<ul style="list-style-type: none; margin: 0; padding: 0;">
				<li>
					<div class="middle-demo-1">
						<a
							href="<?php echo Yii::app()->createUrl('default/message',array('id'=>3))?>">
							<img class="ul_li_img"
							src="<?php echo Yii::app()->baseUrl?>/images/iconfont-biezhen.png" />
							<span class="ul_li_span" style="color: #000000">活动介绍</span>
						</a>
					</div>
					<hr data-am-widget="divider" style="margin-top: 0.1em;"
						class="am-divider am-divider-default" />
				</li>
				<li style="margin-top: -1em;">
					<div class="middle-demo-1">
						<a
							href="<?php echo Yii::app()->createUrl('default/message',array('id'=>2))?>">
							<img class="ul_li_img"
							src="<?php echo Yii::app()->baseUrl?>/images/iconfont-icon.png" />
							<span class="ul_li_span" style="color: #000000">报名流程</span>
						</a>
					</div>
					<hr data-am-widget="divider" style="margin-top: 0.1em;"
						class="am-divider am-divider-default" />
				</li>
				<li style="margin-top: -1em;">
					<div class="middle-demo-1">
						<a
							href="<?php echo Yii::app()->createUrl('default/message',array('id'=>1))?>">
							<img class="ul_li_img"
							src="<?php echo Yii::app()->baseUrl?>/images/iconfont-rongyujiangxiang.png" />
							<span class="ul_li_span" style="color: #000000">奖项设置</span>
						</a>
					</div>
					<hr data-am-widget="divider" style="margin-top: 0.1em;"
						class="am-divider am-divider-default" />
				</li>
			</ul>
		</div>
		<!--搜索-->
		<div class="am-g">
			<div class="am-u-lg-6">
				<div class="am-input-group am-input-group-primary">
					<span class="am-input-group-btn">
						<button onclick="selectIndex()" class="am-btn am-btn-primary"
							style="background-color: #CD853F; border-radius: 5px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-bottom-right-radius: 0px; border-top-right-radius: 0px;"
							type="button">
							<span class="am-icon-search"></span>
						</button>
					</span> <input type="text" id="select_text" placeholder="输入编号或者名称"
						class="am-form-field"
						style="color: #000000; padding-right: 5px; border-radius: 5px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-bottom-left-radius: 0px; border-top-left-radius: 0px;">
				</div>
			</div>
		</div>
		<div>
			<div data-am-widget="tabs" class="am-tabs am-tabs-default"
				style="background-color: #EEEEEE;">
				<ul class="am-tabs-nav am-cf">
					<li class="am-active"><a
						style="border-radius: 10px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-bottom-right-radius: 0px; border-top-right-radius: 0px;"
						href="[data-tab-panel-0]">全部</a></li>
					<li class=""><a
						style="border-radius: 10px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-bottom-left-radius: 0px; border-top-left-radius: 0px;"
						href="[data-tab-panel-1]">最新</a></li>
				</ul>
				<div class="am-tabs-bd"
					style="margin-left: -8px; margin-right: -10px;">
					<div data-tab-panel-0 class="am-tab-panel am-active"
						style="margin-top: -15px; padding-left: 0px; padding-right: 0px;">
						<ul class="grid effect-1" id="hot_ul">
            <?php
            foreach ($model as $value) {
                if($value->is_check=1){
                ?>
                
           <li class="i_li_left">
								<div
									style="border: solid 1px #cdccc9; background-color: #F0F8FF;">
									<a
										href="<?php echo Yii::app()->baseUrl?>/index.php/default/children_msg/<?php echo CHtml::encode($value->id);?>">
										<div
											style="text-align: center; margin: 10px 10px; background-color: #EEEEEE;">
											<img src="<?php echo $value->head_image;?>"
												style="min-height: 150px; width: 100%; padding: 10px 10px 0px 10px;">
											<span class="i_txt"><?php echo CHtml::encode($value->id);?>号：<?php echo CHtml::encode($value->username);?></span>
										</div>
									</a>
									<div style="text-align: center; margin-bottom: 1em;">
										<button onclick="vote(<?php echo $value->id ?>)" type="button"
											class="am-btn am-btn-danger"
											style="font-size: 13px; border-radius: 10px; -webkit-border-radius: 5px; -moz-border-radius: 5px">投票</button>
										<span
											style="color: #CD853F; margin-left: 0.5em; vertical-align: middle;"><?php echo CHtml::encode($value->number);?>票</span>
									</div>
								</div>
							</li>
           <?php
                }
            }
            ?>
            </ul>
            <?php
            if ($count_1 > $number_1) {
                ?> 
              <div id="div_more" style="text-align: center;">
							<button
								onclick="loadMore(<?php echo $count_1;?>,<?php echo $number_1;?>)"
								type="button" class="am-btn am-btn-danger am-round"
								style="width: 250px;">加载更多</button>
						</div>
            <?php
            }
            ?>
          </div>
					<div data-tab-panel-1 class="am-tab-panel "
						style="margin-top: -15px; padding-left: 0px; padding-right: 0px;">
						<ul class="grid effect-1" id="hot_ul2">
            <?php
            foreach ($model2 as $value) {
                ?>
           <li class="i_li_left">
								<div
									style="border: solid 1px #cdccc9; background-color: #F0F8FF;">
									<a
										href="<?php echo Yii::app()->baseUrl?>/index.php/default/children_msg/<?php echo CHtml::encode($value->id);?>">
										<div
											style="text-align: center; margin: 10px 10px; background-color: #EEEEEE;">
											<img src="<?php echo $value->head_image;?>"
												style="min-height: 150px; width: 100%; padding: 10px 10px 0px 10px;">
											<span class="i_txt"><?php echo CHtml::encode($value->id);?>号：<?php echo CHtml::encode($value->username);?></span>
										</div>
									</a>
									<div style="text-align: center; margin-bottom: 1em;">
										<button onclick="vote(<?php echo $value->id ?>)" type="button"
											class="am-btn am-btn-danger"
											style="font-size: 13px; border-radius: 10px; -webkit-border-radius: 5px; -moz-border-radius: 5px">投票</button>
										<span
											style="color: #CD853F; margin-left: 0.5em; vertical-align: middle;"><?php echo CHtml::encode($value->number);?>票</span>
									</div>
								</div>
							</li>
           <?php
            }
            ?>
            </ul>
            <?php
            if ($count_2 > $number_2) {
                ?> 
              <div id="div_more2" style="text-align: center;">
							<button
								onclick="loadMore2(<?php echo $count_2;?>,<?php echo $number_2;?>)"
								type="button" class="am-btn am-btn-danger am-round"
								style="width: 250px;">加载更多</button>
						</div>
            <?php
            }
            ?>              
          </div>
				</div>
			</div>
		</div>
	</div>
	<script
		src="<?php echo Yii::app()->baseUrl?>/layer/masonry.pkgd.min.js"></script>
	<script src="<?php echo Yii::app()->baseUrl?>/layer/imagesloaded.js"></script>
	<script src="<?php echo Yii::app()->baseUrl?>/layer/classie.js"></script>
	<script src="<?php echo Yii::app()->baseUrl?>/layer/AnimOnScroll.js"></script>
	<script type="text/javascript">
new AnimOnScroll( document.getElementById( 'hot_ul' ), {
	minDuration : 0.4,
	maxDuration : 0.7,
	viewportFactor : 0.2
} );
new AnimOnScroll( document.getElementById( 'hot_ul2' ), {
	minDuration : 0.4,
	maxDuration : 0.7,
	viewportFactor : 0.2
} );
</script>
</body>
</html>
